<%@page import="backend.db.ORM"%>
<%@page import="backend.Course"%>
<script type="text/javascript" src="shared/getPage.js"></script>
<script type="text/javascript" src="shared/displayTable.js"></script>
<link rel="stylesheet" type="text/css" href="style/coursesTable.css" />
<div id="main-allCourses">
	<fieldset>
		<legend>All courses: </legend>
		<table class="coursesTable">
				<tr id="firstTr" style="display: none;">
					<th style="width:20%;">Course name</th>
					<th style="width:12%;">Course id</th>
					<th style="width:5%;">Credit points</th>
					<th style="width:10%;">Group number</th>
					<th style="width:12%;">Moed A</th>
					<th style="width:12%;">Moed B</th>
					<th style="width:9%;">Capacity</th>
				</tr>
				<%
					Iterable<Course> courses = ORM.getAllCoursesShallow();
					int size = 0;
					for (Course course : courses) {
				%>
				<tr  id="trOfTable<%=size %>" style="display: none;">
					<td><p><a href="#" onclick="getCoursePage('<%=course.courseName %>');"><%=course.courseName %></a></p></td>
					<td><%=course.courseId %></td>
					<td><%=course.creditPoints %></td>
					<td><%=course.groupNum %></td>
					<td><%=course.moedA %></td>
					<td><%=course.moedB %></td>
					<td><%=course.capacity %></td>
				</tr>
				<%
						size++;
					} %>
		</table>
	</fieldset>
	<script type="text/javascript">
		displayTable(<%=size%>);
	</script>
</div>
